<!--
 * @file 404错误页面
 * @description 页面未找到时显示的错误页面
 * @date 2024-04-01
 -->
<template>
  <view class="error-page">
    <view class="error-content">
      <image class="error-image" src="/static/images/404.png" mode="aspectFit" />
      <view class="error-code">404</view>
      <view class="error-title">页面未找到</view>
      <view class="error-desc">抱歉，您访问的页面不存在或已被移除</view>
      <view class="error-actions">
        <button class="error-btn error-btn--primary" @click="goBack">返回上一页</button>
        <button class="error-btn" @click="goHome">返回首页</button>
      </view>
    </view>
  </view>
</template>

<script setup lang="ts">
// 返回上一页
const goBack = () => {
  uni.navigateBack({
    delta: 1
  });
};

// 返回首页
const goHome = () => {
  uni.reLaunch({
    url: '/pages/monitor/index'
  });
};
</script>

<style lang="scss">
.error-page {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  width: 100vw;
  background-color: #f5f5f5;
}

.error-content {
  text-align: center;
  padding: 30px;
  max-width: 600px;
}

.error-image {
  width: 200px;
  height: 200px;
  margin-bottom: 20px;
}

.error-code {
  font-size: 72px;
  font-weight: bold;
  color: #3385ff;
  margin-bottom: 10px;
}

.error-title {
  font-size: 24px;
  font-weight: 500;
  color: #333;
  margin-bottom: 15px;
}

.error-desc {
  font-size: 16px;
  color: #666;
  margin-bottom: 30px;
}

.error-actions {
  display: flex;
  justify-content: center;
  gap: 15px;
}

.error-btn {
  padding: 10px 20px;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid #e0e0e0;
  background-color: #fff;
  
  &--primary {
    background-color: #3385ff;
    color: white;
    border-color: #3385ff;
    
    &:hover {
      background-color: #2970d6;
    }
  }
  
  &:hover {
    background-color: #f5f5f5;
  }
}

// 响应式调整
@media (max-width: 576px) {
  .error-content {
    padding: 20px;
  }
  
  .error-image {
    width: 150px;
    height: 150px;
  }
  
  .error-code {
    font-size: 60px;
  }
  
  .error-title {
    font-size: 20px;
  }
  
  .error-desc {
    font-size: 14px;
  }
  
  .error-actions {
    flex-direction: column;
    gap: 10px;
  }
}
</style> 